package experiment_forth;

public class Tran {
	public static double sum(double number1,double number2) throws MyException{
		if(number1 < 0 || number2 < 0) {
			throw new MyException("不可以使用负数");
		}
		return (number1+number2);
	}
	
	public final static int x = 5000;
	public final static int y = 8000;
	public final static int z = 17000;

	public static double avg(double num) throws MyException
	{
		 
		if(num > x && num <= y)
		{
			num = num*0.97;
		}else if (num > y && num <= z)
		{
			num = num*0.90;
		}else if(num < x)
		{
			throw new MyException("不需要交税");
		}
		return num;
	}
}

